package panel.publicPanel
{
	import flash.display.Sprite;
	import flash.display.Stage;
	import flash.geom.Rectangle;
	import flash.text.TextField;
	
	import assists.HtmlText;
	import assists.Lang;
	import assists.SizeManager;
	import assists.TextFieldUtils;
	import assists.URI;
	import assists.resource.ResourceLoader;
	
	import inerface.ITextPanel;
	
	import main.ClientConstants;
	
	import panel.viewSpots.StaticSlide;
	
	public class TextPanel extends Sprite implements ITextPanel
	{
		private var _container:Sprite = new Sprite();
		private var _content:TextField = new TextField();
		private var _stage:Stage;
		public function TextPanel()
		{
			super();
			this.addChild(_container);
		}
		
		public function show(content:String):void
		{
			TextFieldUtils.setHtmlText(_content,HtmlText.formatSizeColor(content,0xffffff));
			if(_content.height > _stage.stageHeight * 0.8)
			{
				StaticSlide.beginSlide(_container,_stage,new Rectangle(0,_container.y,0,-_container.height + _stage.stageHeight * (1 - ClientConstants.HOME_UP_PER - ClientConstants.HOME_DOWN_PER)),_container.y)
			}
		}
		
		public function init(stage:Stage, loader:ResourceLoader, lang:Lang, uri:URI=null):void
		{
			_stage = stage;
			
			_content.mouseEnabled = false;
			_content.wordWrap = true;
			_content.multiline = true;
			_content.width = 0.9 * _stage.stageWidth;
			_content.autoSize = "left";
			_content.x = 0.05 * _stage.stageWidth;
			_container.y = SizeManager.UpGuideHeight;
			
			_container.addChild(_content);
		}
		
		public function clear():void
		{
			StaticSlide.clear(this);
		}
	}
}